package com.seeway.wms.utils.ext

import android.view.View
import android.view.animation.Animation
import android.view.animation.LinearInterpolator
import android.view.animation.RotateAnimation

fun rotateAnimation(view: View){
    val animation: RotateAnimation
    val magnify = 10000
    var toDegrees = 360
    var duration = 1000
    toDegrees *= magnify
    duration *= magnify
    animation = RotateAnimation(
        0f, toDegrees.toFloat(),
        Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f
    )
    animation.duration = duration.toLong()
    val lir = LinearInterpolator()
    animation.interpolator = lir
    animation.repeatCount = Animation.INFINITE
    animation.repeatMode = Animation.RESTART
    view.startAnimation(animation)

}